////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                            //
//                                                         WNProject                                                          //
//                                                                                                                            //
//            This file is distributed under the BSD 2-Clause open source license. See License.txt for details.               //
//                                                                                                                            //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef __WN_SPHERE_H__
#define __WN_SPHERE_H__

#include "WNCore/inc/WNTypes.h"
#include "WNMath/inc/WNPoint3.h"

namespace WNMath {
    class WNBounds3;
    class WNBox;
    class WNVector3;

    class WNSphere {
    public:
        WNSphere();
        explicit WNSphere(const WN_FLOAT32* _f);
        explicit WNSphere(const WNPoint3& _location, WN_FLOAT32 _radius);
        explicit WNSphere(WN_FLOAT32 _x, WN_FLOAT32 _y, WN_FLOAT32 _z, WN_FLOAT32 _radius);

        WN_BOOL operator == (const WNSphere& _sphere) const;
        WN_BOOL operator != (const WNSphere& _sphere) const;

        WN_VOID Zero();
        WN_VOID Expand(WN_FLOAT32 _amount);
        WN_BOOL Expand(const WNPoint3& _point, WN_BOOL _anchor = WN_FALSE);
        WN_BOOL Expand(const WNBox& _box, WN_BOOL _anchor = WN_FALSE);
        WN_BOOL Expand(const WNBounds3& _bounds, WN_BOOL _anchor = WN_FALSE);
        WN_BOOL Expand(const WNSphere& _sphere, WN_BOOL _anchor = WN_FALSE);
        WN_VOID Translate(const WNVector3& _vector);

        WN_FLOAT32 Volume() const;
        WN_FLOAT32 SurfaceArea() const;

        WN_BOOL IsZero() const;
        WN_BOOL IsInsideOut() const;

        WN_VOID Set(const WN_FLOAT32* _f);
        WN_VOID Set(const WNPoint3& _location, WN_FLOAT32 _radius);
        WN_VOID Set(WN_FLOAT32 _x, WN_FLOAT32 _y, WN_FLOAT32 _z, WN_FLOAT32 _radius);

        WNSphere GetExpanded(WN_FLOAT32 _amount) const;
        WNSphere GetExpanded(const WNPoint3& _point, WN_BOOL _anchor = WN_FALSE) const;
        WNSphere GetExpanded(const WNBox& _box, WN_BOOL _anchor = WN_FALSE) const;
        WNSphere GetExpanded(const WNBounds3& _bounds, WN_BOOL _anchor = WN_FALSE) const;
        WNSphere GetExpanded(const WNSphere& _circle, WN_BOOL _anchor = WN_FALSE) const;
        WNSphere GetTranslated(const WNVector3& _vector) const;

    public:
        WNPoint3 location;
        WN_FLOAT32 radius;
    };
}

#endif // __WN_SPHERE_H__